Completed
Pull Request — master (#1728)
by Aristeides
04:11 queued 02:08
created

$(document).ready   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
nc 1
dl 0
loc 18
rs 9.4285
nop 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A 0 13 1
1
/* global kirkiWebfonts, WebFont */
2
3
// Asyncronously add webfontloader.
4
( function( document ) {
5
	let wfScript = document.createElement( 'script' ),
6
	    scripts  = document.scripts[0];
7
8
	wfScript.src   = 'https://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js';
9
	wfScript.id    = 'webfontloader';
10
	wfScript.async = true;
11
12
	scripts.parentNode.insertBefore( wfScript, scripts );
13
} )( document );
14
15
jQuery( document ).ready( function() {
16
	let script  = document.querySelector( '#webfontloader' );
17
18
	// Check when the webfontloader finishes loading.
19
	script.addEventListener( 'load', function() {
20
21
		// Loop fonts.
22
		_.each( kirkiWebfonts, function( weights, family ) {
23
24
			// Add font.
25
			WebFont.load( {
26
				google:{
27
					families: [ family + ':' + weights.join( ',' ) + 'cyrillic,cyrillic-ext,devanagari,greek,greek-ext,khmer,latin,latin-ext,vietnamese,hebrew,arabic,bengali,gujarati,tamil,telugu,thai' ]
28
				}
29
			} );
30
		} );
31
	} );
32
} );
33